from time import sleep

from litemall_0805.frame.pages.home_page import HomePage
from selenium.webdriver.common.by import By


class BrandManufacturerList(HomePage):

    def click_add_brand_manufacturer(self):
        self.do_click(By.XPATH, "//*[text()='添加']")

        from litemall_0805.frame.pages.mall_manage.add_BrandManufacturer_pageg import AddBrandManufacturerPage
        return AddBrandManufacturerPage(self.driver)

    def get_add_result(self):
        add_result = self.wait_visible_locate(By.XPATH, "//p[text()='创建成功']")
        return add_result.text

    def click_search_brand_manufacturer(self, name):
        self.do_send_keys(name, By.XPATH, "//*[@placeholder='请输入品牌商名称']")
        self.do_click(By.XPATH, "//*[text()='查找']")

        return self

    def get_search_result(self, name):
        search_res = self.do_find(By.XPATH, f"//*[text()='{name}']")
        return search_res.text

    def click_export_brand_manufacturer(self):
        pass

    def click_delete_brand_manufacturer(self):
        pass

    def click_edit_brand_manufacturer(self):
        pass
